<%/*
 * Copyright (c) 2007
 *	Alberto Magni, Maggioni Marcello
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */%>
 
 <%-- 
    Document   : index
    Created on : 3-nov-2007, 13.44.31
    Author     : alberto
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.Map"%>
<%@ taglib uri="/WEB-INF/tlds/login" prefix="access" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<!-- 
    Document   : up
    Created on : 30-nov-2007, 23.27.41
    Author     : alberto
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page import="Database.*" %>
<html>
  <head>
	<!-- Include the javascript -->
	<script src="multifile_compressed.js"></script>
        <title>Input</title>
</head>

<body>
        <access:LoginTag/>
        <jsp:include page="username.jsp"/>
        <jsp:useBean id="loggedin" type="beans.LoginBean" scope="session"/>
        <%--<jsp:useBean id="cdb" type="Database.ConfigurationDB" scope="session"/>--%>
        
        <% 
        ConfigurationDB cdb = (ConfigurationDB) application.getAttribute("configurationdb");
        String email=null;
        if(loggedin.isAdmin())
        {
            email = cdb.getEMailAddress(null);
        }
        else
        {
            email = cdb.getEMailAddress(loggedin.getUsername());
        }
        if (email == null)
            email = "";%>
    <h2>Please insert the information to send the email</h2>
        <hr>
        <p>In the filed 'To:' insert the path of the file with the list of 
        addresses to send your mail. This can be: a .xml, a .csv or a .ldif.<br>
        In the field 'File:' insert the file with the text of your e-mail;
        this could be a .txt or .html.<br>You can send a maximum of 15 attachments.</p>
<!-- This is the form -->
<form enctype="multipart/form-data" action="BridgeSrv" method = "post">
    <table>
    <tr><td>Subject:</td><td><input name="subject" type="text"/></td></tr>
    <tr><td>From:</td><td><input name="from" type="text" value="<%= email %>"/></td></tr> 
    <tr><td>To:</td><td><input type="file" name="to"/>
    <tr><td>File:</td><td><input type="file" name="fileoftext"/>
    <tr><td>Attachment:</td><td><input id="my_file_element" type="file" name="attachment"/></td></tr>
    <tr><td>Password:</td><td><input name="password" type="password"/></td></tr>
    <input type="submit" value="Send">
    </table>
</form>
Attachments:
<div id="files_list"></div>
<script>
	var multi_selector = new MultiSelector( document.getElementById( 'files_list' ), 15 );
	multi_selector.addElement( document.getElementById( 'my_file_element' ) );
</script>
<form action="ConfigSelectionSrv">
    <input type=submit value="Configure">
</form>
<jsp:include page="logout.jsp"/>
</body>
</html>